<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/

//if ( !is_superadmin() && !check_purview('manage_config') ) prompt('对不起，你没有权限执行本操作！');
if (getGP('type','G')!='1'){
get_config_keytable("config_log");
}
empty($do) && $do = 'list';

$message = array(
	1 => '成功更新系统信息。'
);
//echo $message[1];

if ($do == 'list') {
	
	//列表信息 
	$wheresql = '';
	$page = max(1, getGP('page','G','int'));
	$pagesize = 20;
	$offset = ($page - 1) * $pagesize;
	$url = 'admin.php?ac=log&fileurl=config';

	if ($keyword = getGP('keyword','G')) {
		$wheresql .= " AND name LIKE '%$keyword%'";
		$url .= '&keyword='.rawurlencode($keyword);
	}
	if (getGP('type','G')=='1'){
	$wheresql .= " AND uid='".$_USER->id."'";
		$url .= '&type='.getGP('type','G');
	}
	
	$num = $db->result("SELECT COUNT(*) AS num FROM ".DB_TABLEPRE."loginlog WHERE 1 $wheresql");
     $sql = "SELECT * FROM ".DB_TABLEPRE."loginlog WHERE 1 $wheresql ORDER BY id desc LIMIT $offset, $pagesize";
	 $result = $db->fetch_all($sql);

     include_once('template/log.php');
	 
}elseif ($do == '删 除') {
    get_config_keytable("config_log_delete");
	$idarr = getGP('id','P','array');
	foreach ($idarr as $id) {
	$db->query("DELETE FROM ".DB_TABLEPRE."loginlog WHERE id = '$id'");
	
	}
	goto_page('admin.php?ac=log&fileurl=config');

} 

?>